from django.views.generic.simple import direct_to_template
from django.shortcuts import get_object_or_404
from craft_life.utils import paginate
from models import BlogRecord


def show_all(request):
    collection = BlogRecord.get_to_show()
    return direct_to_template(request, 'blog/list.html', {'pgn': paginate(collection)})

def show_one(request, id):
    return direct_to_template(request, 'blog/one.html', {'r': get_object_or_404(BlogRecord, id=id)})
